package cn.kailangtu.dataspot.logs;

import android.util.Log;

import org.litepal.LitePal;

import cn.kailangtu.commontools.DateTimeUtils;
import cn.kailangtu.dataspot.db.ExceptionLogEntity;
import cn.kailangtu.dataspot.db.OptionLogEntity;

public class OptionLog {
    public synchronized static void log(String item,String value,int optionType){
        Log.d("SHOOTLEE","OptionLog==>Log begin");
        String content = "操作项:"+item;
        if(optionType == 1)
        {
            content+=",值："+value;
        }
        int id =  LitePal.max(OptionLogEntity.class,"logNumber", Integer.class);
        OptionLogEntity entity = new OptionLogEntity();
        entity.setLogContent(content);
        entity.setLogNumber(id+1);
        entity.setLogTime(DateTimeUtils.longToYMDHMS(System.currentTimeMillis()));
        entity.setOptionType(optionType);
        entity.save();
        Log.d("SHOOTLEE","OptionLog==>Log end");
    }
}
